package com.jiepos.mpos.inter.push.getui;

import com.alibaba.fastjson.JSONObject;
import com.jiepos.mpos.common.constant.ExceptionConstant;
import com.jiepos.mpos.core.exception.MposException;

/**
 * @ClassName: MposPushTemp
 * @Description: 透传消息模板
 * @author 孙永
 * @date 2017年10月16日 下午4:29:21
 */
public class GTPushTemplet extends JSONObject{

	private static final long serialVersionUID = -158476113569248348L;
	
	/** 推送类型*/
	public enum PushType{
		/** 系统通知公告:notice*/
		notice,
		/** 系统消息:message*/
		message
	}

	/** 标题*/
	private String title;
	
	/** 内容*/
	private String content;
	
	/** 日期或时间*/
	private String date;
	
	/** 图片链接*/
	private String imgUrl;
	
	/** 推送类型*/
	private PushType pushType;
	
	/** 其它链接*/
	private String url;
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	
	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public String getImgUrl() {
		return imgUrl;
	}

	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl;
	}

	public PushType getPushType() {
		return pushType;
	}

	public void setPushType(PushType pushType) {
		this.pushType = pushType;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}
	
	public String toString(){
		if(this.pushType == null){
			throw new MposException(ExceptionConstant.PUSH_TYPE_NULL);
		}
		super.put("title", this.title);
		super.put("content", this.content);
		super.put("imgUrl", this.imgUrl);
		super.put("pushType", this.pushType.toString());
		super.put("url", this.url);
		return toJSONString();
	}
}
